<!DOCTYPE html>
<html>

<head>
    <title>LabelOverlay</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body,
        html {
            width: 100%;
            height: 100%;
            margin: 0;
            font-family: "微软雅黑";
        }

        #allmap {
            width: 100%;
            height: 100%;
        }

        p {
            margin-left: 5px;
            font-size: 14px;
        }
    </style>
    <script>
        window.TD = {
            config: {
                workerPath: '../dist/worker.js'
            }
        };
    </script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=0lPULNZ5PmrFVg76kFuRjezF"></script>
    <script src="data/data2.js"></script>
    <script src="../dist/inMap.js"></script>
</head>

<body>
    <div id="allmap"></div>
</body>

</html>
<script>
    var map = new inMap.Map({
        id: 'allmap',
        mpZoom: {
            show: true,
            value: 16,
            min: 4,
            max: 18,
        },
        skin: 'Blueness'
    });


    map.getMap().centerAndZoom(new BMap.Point(105.403119, 38.028658), 6)
    var overlay = new inMap.DotOverlay({
        tooltip: {
            show: true,
            position: 'top',
            // formatter: function (params) {
            //     return params.count;
            // }
            formatter: "{count}~<br/>{count}"
        },
        legend: {
            show: true,
            data: ["描述1", "描述2", "描述3", "描述4"],
            formatter: function (start, end, index) {
                return start + "万~" + (end || "max") + "万";
            },
            position: "right"
        },

        style: {
            normal: {
                backgroundColor: 'rgba(200, 200, 50, 1)',
                borderWidth: 1,
                borderColor: "rgba(255,255,255,1)",
                size: 3,
                label: {
                    show: true,
                    color: 'rgba(255,255,255,1)'

                },
            },
            mouseOver: {
                backgroundColor: 'rgba(200, 200, 200, 1)',
                borderColor: "rgba(255,255,255,1)",
                borderWidth: 4,
            },
            selected: {
                backgroundColor: 'rgba(184,0,0,1)',
                borderColor: "rgba(255,255,255,1)"
            },
            splitList: [{ //设置区间颜色
                    start: 0,
                    end: 2,
                    size: 3,
                },
                {
                    start: 2,
                    end: 5,
                    size: 6,
                },
                {
                    start: 5,
                    end: 7,
                    size: 9,
                },
                {
                    start: 7,
                    size: 12,
                }
            ],

        },
        data: data,
        event: {
            onMouseClick: function (item) {
                //能获取当前点的信息
            }
        }

    });
    map.add(overlay);
</script>